import http from "@/utils/http/index";

//定义参数或者返回执数据类型

interface Province{
    id:string|number,
    name:string
}

interface City extends Province{
    provinceId:string|number
}

interface District extends Province{
    cityId:string|number
}

let provinceList = ()=>{
    return http.get<Province[]>("/admin/region/province/list");
}

let cityList =(provinceId:string|number)=>{
    return http.get<City[]>(`/admin/region/city/listByProvinceId?id=${provinceId}`);
}

let districtList =(cityId:string|number)=>{
    return http.get<District[]>(`/admin/region/district/listByCityId?id=${cityId}`);
}

export {
    type Province,
    type City,
    type District,
    provinceList,
    cityList,
    districtList
}
